﻿<Page x:Class="Road3App.Views.UserControls.EditControls.EditPhasesPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:ucecc="clr-namespace:Road3App.Views.UserControls.EditControls.Crossroad"
	Title="EditPhases">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        
        <TextBlock Text="Click on cell to change traffic light state" Grid.Row="0"/>
        
        <Grid Grid.Row="1" Margin="0,10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            
            <Grid Grid.Column="0" >
                <ucecc:EditGridUC DataContext="{Binding CrossroadVM}" MouseDown="EditGridUC_MouseDown_1"/>
            </Grid>
            
            <DockPanel Grid.Column="1" Margin="10,0,0,0">
                <DockPanel.Resources>
                    <Style TargetType="Button">
                        <Setter Property="Width" Value="50"/>
                        <Setter Property="Height" Value="25"/>
                    </Style>
                    <Style TargetType="TextBlock">
                        <Setter Property="VerticalAlignment" Value="Center"/>
                        <Setter Property="Width" Value="50"/>
                    </Style>
                    <Style TargetType="TextBox">
                        <Setter Property="Width" Value="50"/>
                    </Style>
                    <Style TargetType="Rectangle">
                        <Setter Property="Width" Value="10"/>
                    </Style>
                </DockPanel.Resources>
                <TextBlock Text="Phases" DockPanel.Dock="Top"/>                
                <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Center">
                    <Button Content="Add" Click="Button_Click_1"/>
                    <Rectangle/>
                    <Button Content="Insert" Click="Button_Click_2"/>
                    <Rectangle/>
                    <Button Content="Remove" Click="Button_Click_3"/>
                </StackPanel>
                <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,0,0,10">
                    <TextBlock Text="Index"/>
                    <Rectangle/>
                    <TextBox Text="{Binding SelectedPhase.Index}"/>
                    <Rectangle/>
                    <TextBlock Text="Length"/>
                    <Rectangle/>
                    <TextBox Text="{Binding SelectedPhase.Length}"/>
                </StackPanel>

                <ListBox Margin="0,10"
                         ItemsSource="{Binding PhaseCollection}" 
                         SelectedItem="{Binding SelectedPhase}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Index}" Width="20"/>
                                <TextBlock Text="{Binding Length}" Width="20"/>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </DockPanel>
        </Grid>
    </Grid>
</Page>
